package zjt.calendar;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class demo2 {
    public static void main(String[] args) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(2020,1,12);
        /*System.out.println(calendar.get(Calendar.YEAR));
        System.out.println(calendar.get(Calendar.MONTH)+1);
        System.out.println(calendar.get(Calendar.DATE));*/
        Date date = calendar.getTime();
        System.out.println(new SimpleDateFormat("yyyy-MM-dd").format(date));
        System.out.println("__________");
        Date date2 = new Date();
        calendar.setTime(date2);
        Date date3 = calendar.getTime();
        System.out.println(new SimpleDateFormat("yyyy-MM-dd").format(date3));
    }
}
